//
//  MeViewController.m
//  V-Learn
//
//  Created by Apple on 2018/12/20.
//  Copyright © 2018 yxk. All rights reserved.
//

#import "MeViewController.h"
#import "VKMineModel.h"
#import "VKMineCell.h"
#import "VKPersonInfoModel.h"
// 个人档案
#import "VKMainPersonController.h"
// 实名认证
#import "VKCertificateController.h"
// 积分商城
#import "VKJiFenShopController.h"
// 代金券
#import "VKVoucherController.h"
// 我的订单
#import "VKMeOrderController.h"
// 推荐好友
#import "VKRefriendsController.h"
// 意见反馈
#import "VKSuggestionController.h"
// 我的消息
#import "VKMeMessageController.h"
// 设置
#import "VKSettingController.h"
// 粉丝
#import "VKFansController.h"
// 关注
#import "VKFollowController.h"
// 个人信息
#import "VKPersonInfoController.h"
//账户余额
#import "MoneyViewController.h"
@interface MeViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *mineTableView;
@property (nonatomic, strong) NSMutableArray *dataArray;

@property (nonatomic, strong) UIImageView *iconImageV;
@property (nonatomic, strong) UIImageView *vipImageV;

@property (nonatomic, strong) UILabel *nickNameLabel;
@property (nonatomic, strong) UILabel *ageLabel;
@property (nonatomic, strong) UIImageView *ageImageV;
@property (nonatomic, strong) UILabel *numLabel;
@property (nonatomic, strong) NSMutableArray *countArray;
@property (nonatomic, strong) NSString *moneyString;
@property (nonatomic, strong) VKPersonInfoModel *personInfoModel;
@property (nonatomic, strong) UILabel *attenNumLabel;/**关注数*/
@property (nonatomic, strong) UILabel *fansNumLabel;/**粉丝数*/


@end

@implementation MeViewController
-(UITableView *)mineTableView{
    if (_mineTableView == nil) {
        _mineTableView = [[UITableView alloc]initWithFrame:CGRectMake(0,-LBHeight_StatusBar, [UIScreen cz_screenWidth], [UIScreen cz_screenHeight] - LBHeight_TabBar + LBHeight_StatusBar) style:UITableViewStylePlain];
        //        _mineTableView = [[UITableView alloc] initWithFrame:CGRectMake(0*kScaleFit, -20*kScaleFit, ScreenW, ScreenH+20) style:UITableViewStylePlain];
        _mineTableView.delegate = self;
        _mineTableView.dataSource = self;
        [self.view addSubview:_mineTableView];
        
        [self setupTableHeader];
    }
    return _mineTableView;
}

-(NSMutableArray *)dataArray{
    if (_dataArray == nil) {
        _dataArray = [[NSMutableArray alloc]init];
    }
    return _dataArray;
}
-(NSMutableArray *)countArray{
    if (_countArray == nil) {
        _countArray = [[NSMutableArray alloc]init];
    }
    return _countArray;
}
// 表视图头部
- (void)setupTableHeader{
    
    UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen cz_screenWidth], 285*ScaleX)];
    self.mineTableView.tableHeaderView = headerView;
    
    NSString *token = [UserModel getUserModel].token;
    
    UIImageView *imageV = [[UIImageView alloc]init];
    imageV.image = [UIImage imageNamed:@"my-bg"];
    [headerView addSubview:imageV];
    imageV.userInteractionEnabled = NO;
    [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
        //        make.height.equalTo(@180*ScaleX);
        make.height.mas_equalTo(180*ScaleX);
        make.width.equalTo(@([UIScreen cz_screenWidth]));
        make.top.mas_equalTo(headerView);
    }];
    
    UILabel *titleLabel = [[UILabel alloc]init];
    [headerView addSubview:titleLabel];
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.text = @"个人中心";
    titleLabel.font = [UIFont systemFontOfSize:19*ScaleX];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(headerView);
        make.top.mas_equalTo(headerView).offset(LBNAVBAR_HEIGHT - 30*ScaleX);
    }];
    
    UIImageView *circleImageV = [[UIImageView alloc]init];
    circleImageV.image = [UIImage imageNamed:@"white-bg"];
    [headerView addSubview:circleImageV];
    circleImageV.userInteractionEnabled = YES;
    [circleImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(18*ScaleX);
        make.right.mas_equalTo(@(-18*ScaleX));
        make.height.mas_equalTo(180*ScaleX);
        make.top.mas_equalTo(titleLabel.mas_bottom).offset(20*ScaleX);
    }];
    
    UIImageView *iconImageV = [[UIImageView alloc]init];
    iconImageV.image = [UIImage imageNamed:@"vkboy"];
    iconImageV.backgroundColor = [UIColor redColor];
    iconImageV.contentMode = UIViewContentModeScaleAspectFill;
    iconImageV.clipsToBounds = YES;
    _iconImageV = iconImageV;
    [headerView addSubview:iconImageV];
    iconImageV.userInteractionEnabled = NO;
    iconImageV.layer.cornerRadius = 41*ScaleX;
    iconImageV.layer.masksToBounds = YES;
    [iconImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(circleImageV).offset(22*ScaleX);
        //        make.height.width.equalTo(@82*ScaleX);
        make.size.mas_equalTo(CGSizeMake(82*ScaleX, 82*ScaleX));
        make.top.mas_equalTo(circleImageV).offset(18*ScaleX);
    }];
    
    UIImageView *vipImageV = [[UIImageView alloc]init];
    //    vipImageV.image = [UIImage imageNamed:@"wk_vip"];
    vipImageV.contentMode = UIViewContentModeScaleAspectFill;
    vipImageV.clipsToBounds = YES;
    _vipImageV = vipImageV;
    [headerView addSubview:vipImageV];
    vipImageV.userInteractionEnabled = NO;
    vipImageV.layer.cornerRadius = 9*ScaleX;
    vipImageV.layer.masksToBounds = YES;
    [vipImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(iconImageV).offset(0);
        make.size.mas_equalTo(CGSizeMake(18*ScaleX, 18*ScaleX));
        make.bottom.mas_equalTo(iconImageV);
    }];
    UILabel *nickNameLabel = [[UILabel alloc]init];
    [headerView addSubview:nickNameLabel];
    _nickNameLabel = nickNameLabel;
    if (token == nil) {
        nickNameLabel.text = @"请登录>";
        nickNameLabel.textColor = [UIColor cz_colorWithRed:236 green:86 blue:39];
        UIButton *tapButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [headerView addSubview:tapButton];
        [tapButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(nickNameLabel);
        }];
        [tapButton addTarget:self action:@selector(tapClick) forControlEvents:UIControlEventTouchUpInside];
    }else{
        nickNameLabel.text = @"";
        nickNameLabel.textColor = [UIColor cz_colorWithRed:52 green:52 blue:52];
    }
    
    nickNameLabel.font = [UIFont systemFontOfSize:16*ScaleX];
    [nickNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        if (token == nil) {
            make.centerY.equalTo(iconImageV);
        }else{
            make.top.mas_equalTo(iconImageV).offset(6*ScaleX);
        }
        make.left.mas_equalTo(iconImageV.mas_right).offset(20*ScaleX);
    }];
    
    UILabel *ageLabel = [[UILabel alloc]init];
    [headerView addSubview:ageLabel];
    _ageLabel = ageLabel;
    ageLabel.textColor = [UIColor cz_colorWithRed:52 green:52 blue:52];
    
    //    ageLabel.text = @"5岁";
    if (token == nil) {
        ageLabel.text = @"0岁";
    }
    
    //    ageLabel.text = @"";
    
    ageLabel.font = [UIFont systemFontOfSize:15*ScaleX];
    [ageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(nickNameLabel);
        make.top.mas_equalTo(nickNameLabel.mas_bottom).offset(5*ScaleX);
    }];
    
    UIImageView *ageImageV = [[UIImageView alloc]init];
    _ageImageV = ageImageV;
    ageImageV.image = [UIImage imageNamed:@"boy"];
    ageImageV.userInteractionEnabled = NO;
    [headerView addSubview:ageImageV];
    [ageImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(ageLabel.mas_right).offset(12*ScaleX);
        make.size.mas_equalTo(CGSizeMake(16*ScaleX, 16*ScaleX));
        make.centerY.mas_equalTo(ageLabel);
    }];
    
    
    UILabel *numLabel = [[UILabel alloc]init];
    _numLabel = numLabel;
    [headerView addSubview:numLabel];
    numLabel.textColor = [UIColor cz_colorWithRed:52 green:52 blue:52];
    
    numLabel.text = @"2018052609";
    if (token==nil) {
        numLabel.hidden = YES;
    }else{
        numLabel.hidden = NO;
    }
    
    //    numLabel.text = @"    ";
    
    numLabel.font = [UIFont systemFontOfSize:16*ScaleX];
    [numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(nickNameLabel);
        make.top.mas_equalTo(ageLabel.mas_bottom).offset(8*ScaleX);
    }];
    
    
    UIButton *button = [[UIButton alloc]init];
    [headerView addSubview:button];
    //    button.backgroundColor = [UIColor redColor];
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        //        make.width.height.equalTo(@30);
        make.size.mas_equalTo(CGSizeMake(30*ScaleX, 30*ScaleX));
        make.centerY.equalTo(iconImageV);
        make.right.mas_equalTo(circleImageV.mas_right).offset(-15*ScaleX);
    }];
    [button addTarget:self action:@selector(buttonClick) forControlEvents:UIControlEventTouchUpInside];
    UIImageView *arrowImageV = [[UIImageView alloc]init];
    arrowImageV.image = [UIImage imageNamed:@"left"];
    arrowImageV.userInteractionEnabled = NO;
    [button addSubview:arrowImageV];
    [arrowImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(button);
        make.height.equalTo(20*ScaleX);
        //        make.width.equalTo(@12);
        make.width.mas_equalTo(12*ScaleX);
    }];
    [self.view layoutIfNeeded];
    for (int i = 0; i < 2; i++) {
        UIButton *centerButton = [[UIButton alloc]initWithFrame:CGRectMake(i * ([UIScreen cz_screenWidth] - 36*ScaleX) / 2.0, 118*ScaleX, ([UIScreen cz_screenWidth] - 36*ScaleX)/ 2.0, 50*ScaleX)];
        centerButton.tag = 8818 + i;
        centerButton.userInteractionEnabled = YES;
        [centerButton addTarget:self action:@selector(buttonCenterClick:) forControlEvents:UIControlEventTouchUpInside];
        [circleImageV addSubview:centerButton];
        //        centerButton.backgroundColor = [UIColor cz_randomColor];
        UILabel *topLabel = [[UILabel alloc]init];
        if (self.countArray.count == 0) {
            topLabel.text = @"0";
        }else{
            topLabel.text = self.countArray[i];
        }
        topLabel.tag = 2000 + i;
        topLabel.textColor = [UIColor cz_colorWithRed:236 green:86 blue:39];
        topLabel.font = [UIFont systemFontOfSize:22*ScaleX];
        [centerButton addSubview:topLabel];
        [topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(centerButton);
            make.top.mas_equalTo(centerButton);
        }];
        
        UILabel *downLabel = [[UILabel alloc]init];
        if (i == 0) {
            downLabel.text = @"关注";
        }else if (i == 1){
            downLabel.text = @"粉丝";
        }
        downLabel.textColor = [UIColor cz_colorWithRed:50 green:50 blue:50];
        downLabel.font = [UIFont systemFontOfSize:14*ScaleX];
        [centerButton addSubview:downLabel];
        [downLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(centerButton);
            make.top.mas_equalTo(topLabel.mas_bottom);
        }];
        
    }
    
    UIView *downView = [[UIView alloc]init];
    [headerView addSubview:downView];
    downView.backgroundColor = [UIColor cz_colorWithRed:242 green:242 blue:242];
    [downView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@13);
        make.left.right.bottom.equalTo(headerView);
    }];
    
    if (token == nil) {
        ageLabel.hidden = YES;
        ageImageV.hidden = YES;
        numLabel.hidden = YES;
        button.hidden = YES;
        arrowImageV.hidden = YES;
    }else{
        ageLabel.hidden = NO;
        ageImageV.hidden = NO;
        numLabel.hidden = NO;
        button.hidden = NO;
        arrowImageV.hidden = NO;
    }
}
// 请登录点击
- (void)tapClick{
    [UserModel clearUserInfo];
    LBLoginVC *loginVC = [[LBLoginVC alloc] init];
    loginVC.jumpType = @"1";//1 不隐藏导航
    [self.navigationController pushViewController:loginVC animated:YES];
}
- (void)buttonCenterClick:(UIButton *)sender{
    NSString *token = [UserModel getUserModel].token;
    if (token == nil) {
        [UserModel clearUserInfo];
        LBLoginVC *loginVC = [[LBLoginVC alloc] init];
        loginVC.jumpType = @"1";//1 不隐藏导航
        [self.navigationController pushViewController:loginVC animated:YES];
        return;
    }
    if (sender.tag == 8819) {
        VKFansController *fans = [[VKFansController alloc]init];
        [self.navigationController pushViewController:fans animated:YES];
    }else{
        VKFollowController *fans = [[VKFollowController alloc]init];
        [self.navigationController pushViewController:fans animated:YES];
    }
}

- (void)buttonClick{
    
    NSString *token = [UserModel getUserModel].token;
    if (token == nil) {
        [UserModel clearUserInfo];
        LBLoginVC *loginVC = [[LBLoginVC alloc] init];
        loginVC.jumpType = @"1";//1 不隐藏导航
        [self.navigationController pushViewController:loginVC animated:YES];
        return;
    }
    VKPersonInfoController *fans = [[VKPersonInfoController alloc]init];
    fans.isVip = self.personInfoModel.isVip;
    [self.navigationController pushViewController:fans animated:YES];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    //    self.edgesForExtendedLayout = @[];
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    // self.title = @"个人中心";
    [self setupData];
    [self mineTableView];
    
    
}

- (void)setupPersonInfoData{
    [self setupTableHeader];
    
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    hud.labelText = @"正在加载...";
    [hud show:YES];
    VKWeakSelf(self)
    
    NSString *token = [UserModel getUserModel].token;
    if (token) {
        NSMutableDictionary *data = [NSMutableDictionary dictionary];
        [data setObject:token forKey:@"token"];
        [WYHXNetWorkService netWorkSerViceRequestWithGetUrl:WKMeUserInfo withPostParams:data withBlock:^(NSDictionary *result, NSError *error) {
            hud.hidden = YES;
            NSString *code = result[@"code"];
            NSString *username;
            NSString *tel;
            NSString *sex; // <null>
            NSString *headImg;// <null>
            NSString *age;// <null>
            if ([code integerValue] == 200) {
                
                VKPersonInfoModel *model = [VKPersonInfoModel mj_objectWithKeyValues:result[@"data"]];
                self.personInfoModel = model;
                self.moneyString = model.userMoney;
                if ([model.username isEqual:[NSNull null]]) {
                    weakself.nickNameLabel.text = @"昵称";
                }else{
                    weakself.nickNameLabel.text = model.username;
                }
                if ([model.tel isEqual:[NSNull null]]) {
                    weakself.numLabel.text = @"手机号";
                }else{
                    if ([model.isVisitor isEqualToString:@"1"]) {
                        weakself.numLabel.text = @"";
                    }else{
                        weakself.numLabel.text = model.tel;
                    }
                    
                }
                if ([model.sex isEqual:[NSNull null]]) {
                    weakself.ageImageV.image = [UIImage imageNamed:@"boy"];
                }else{
                    if ([model.sex integerValue] == 0) {
                        weakself.ageImageV.image = [UIImage imageNamed:@"lbgirl"];
                    }else {
                        weakself.ageImageV.image = [UIImage imageNamed:@"boy"];
                    }
                }
                
                if ([model.headImg isEqual:[NSNull null]]) {
                    headImg = @"";
                }else{
                    [weakself.iconImageV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",Public_URL,model.headImg]] placeholderImage:[UIImage imageNamed:@"vkboy"]];
                }
                if ([model.age isEqual:[NSNull null]]) {
                    weakself.ageLabel.text = [NSString stringWithFormat:@"0岁"];
                }else{
                    weakself.ageLabel.text = [NSString stringWithFormat:@"%@岁",model.age];
                }
                // 粉丝数 和 关注数
                [self.countArray addObject:model.attenNum];
                [self.countArray addObject:model.fansNum];
                self.attenNumLabel = [self.view viewWithTag:2000];
                self.fansNumLabel = [self.view viewWithTag:2001];
                self.attenNumLabel.text = model.attenNum;
                self.fansNumLabel.text = model.fansNum;
                if ([model.isVip integerValue]==1) {
                    
                    weakself.vipImageV.image = [UIImage imageNamed:@"wk_vip"];
                }else{
                    weakself.vipImageV.image = [UIImage imageNamed:@""];
                }
                //            [MBProgressHUD showSuccess:@"获取成功" toView:self.view];
                if ([model.headImg isEqual:[NSNull null]]) {
                    headImg = @"";
                }else{
                    if ([model.sex isEqual:[NSNull null]]) {
                        [weakself.iconImageV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",Public_URL,model.headImg]] placeholderImage:[UIImage imageNamed:@"vkgirl"]];
                    }else{
                        [weakself.iconImageV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",Public_URL,model.headImg]] placeholderImage:[model.sex integerValue] == 0 ? [UIImage imageNamed:@"vkgirl"] : [UIImage imageNamed:@"vkboy"]];
                    }
                }
                if ([model.age isEqual:[NSNull null]]) {
                    weakself.ageLabel.text = [NSString stringWithFormat:@"0岁"];
                    
                }else{
                    //                    [MBProgressHUD showSuccess:result[@"msg"] toView:self.view];
                }
            }else if([code integerValue]==401) {
                //                [MBProgressHUD showSuccess:result[@"msg"] toView:self.view];
                //                self.gotoLoginString = @"401";
                [UserModel clearUserInfo];
                //                [hud hide:YES];
                //                headImg = @"";
                //                weakself.numLabel.text = @"手机号";
                //                weakself.ageLabel.text = [NSString stringWithFormat:@"0岁"];
                //                weakself.ageImageV.image = [UIImage imageNamed:@"boy"];
                //                _nickNameLabel.text = @"请登录>";
            }
            [self.mineTableView reloadData];
            
        }];
    }else{
        [hud hide:YES];
        self.attenNumLabel = [self.view viewWithTag:2000];
        self.fansNumLabel = [self.view viewWithTag:2001];
        self.attenNumLabel.text = @"0";
        self.fansNumLabel.text = @"0";
        [self.mineTableView reloadData];
    }
    
}
- (void)setupData{
    //        NSArray *imageArray = @[@"grda",@"smrz",@"wddjq",@"wddd",@"yjfk",@"wdxx",@"sz"];
    NSArray *imageArray;
    NSArray *titleArray;

        imageArray = @[@"grda",@"smrz",@"jfsc",@"wanke_qianbao",@"wddjq",@"wddd",@"tjhy",@"yjfk",@"wdxx",@"sz"];
        
        titleArray = @[@"个人档案",@"实名认证",@"积分商城",@"我的钱包",@"我的优惠券",@"我的订单",@"推荐好友",@"意见反馈",@"我的消息",@"设置"];

    //    NSArray *titleArray = @[@"个人档案",@"实名认证",@"我的代金券",@"我的订单",@"意见反馈",@"我的消息",@"设置"];
    
    for (int i = 0; i < imageArray.count; i++) {
        VKMineModel *mineModel = [[VKMineModel alloc]init];
        mineModel.imageString = imageArray[i];
        mineModel.titleString = titleArray[i];
        [self.dataArray addObject:mineModel];
    }
    self.moneyString = @"0";
    
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _dataArray.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    VKMineCell *cell = [VKMineCell cellWithTableView:tableView];
    cell.model = self.dataArray[indexPath.row];
    if (indexPath.row==3) {
        cell.priceLab.hidden = NO;
//        NSString *userMoney = [[NSUserDefaults standardUserDefaults] objectForKey:@"userMoney"];
        cell.priceLab.text = [NSString stringWithFormat:@"%@乐学币",self.moneyString];
    }else{
        cell.priceLab.hidden = YES;
    }
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    NSString *token = [UserModel getUserModel].token;
    
    if (token == nil||token.length==0) {
        //        [UIApplication sharedApplication].keyWindow.rootViewController = [[LBLoginVC alloc]init];
        //        return;
        [UserModel clearUserInfo];
        LBLoginVC *loginVC = [[LBLoginVC alloc] init];
        loginVC.jumpType = @"1";//1 不隐藏导航
        [self.navigationController pushViewController:loginVC animated:YES];
        return;
    }
        if (indexPath.row == 0) { // 个人档案
            [self.navigationController pushViewController:[[VKMainPersonController alloc]init] animated:YES];
        }else if(indexPath.row == 1){
            [self.navigationController pushViewController:[[VKCertificateController alloc]init] animated:YES];
        }else if(indexPath.row == 2){ // 积分商城

            [self.navigationController pushViewController:[[VKJiFenShopController alloc]init] animated:YES];
        }else if(indexPath.row == 3){ // 代金券


            [self.navigationController pushViewController:[[MoneyViewController alloc]init] animated:YES];
        }else if(indexPath.row == 4){ // 我的订单
#pragma mark -
//            [self.navigationController pushViewController:[[VKVoucherController alloc]init] animated:YES];

            [self.navigationController pushViewController:[[VKVoucherController alloc]init] animated:YES];
        }else if(indexPath.row == 5){ // 推荐好友
            [self.navigationController pushViewController:[[VKMeOrderController alloc]init] animated:YES];
//

        }else if(indexPath.row == 6){ // 意见反馈
            VKRefriendsController *friendVC = [[VKRefriendsController alloc] init];
            friendVC.userName = self.personInfoModel.username;
            [self.navigationController pushViewController:friendVC animated:YES];
        }else if(indexPath.row == 7){ // 我的消息
            [self.navigationController pushViewController:[[VKSuggestionController alloc]init] animated:YES];
        }else if(indexPath.row == 8){// 设置
            [self.navigationController pushViewController:[[VKMeMessageController alloc]init] animated:YES];
        }else if (indexPath.row==9){
            [self.navigationController pushViewController:[[VKSettingController alloc]init] animated:YES];
        }

    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 58;
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.moneyString = @"0";
    [self setupPersonInfoData];
    [self.navigationController setNavigationBarHidden:YES animated:animated];
    
}
- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:animated];
}

-(UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}

@end
